package com.fsx.serverupfile;

import com.fsx.serverupfile.model.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(IllegalArgumentException.class)
    public Result<String> exceptionHandler(IllegalArgumentException e) {
        return new Result<>(1, e.getMessage());
    }

//    @ExceptionHandler(value = Exception.class)
//    public Result<String> exceptionHandler(Exception e) {
//        return new Result<>(-1, "系统出了点问题,请稍后再试");
//    }

}
